package com.chenye.generator;

/**
 * @Auther:chenye
 * @Data:2018/7/6
 * @Description:
 */
public class ManGenerator<T> implements Generator<T>{
    private T man;

    public ManGenerator(T man) {
        this.man = man;
    }

    @Override
    public T get() {
        return man;
    }

    public <T> T showKeyName(Generator<T> container){
        System.out.println("container key :" + container.get());
        //当然这个例子举的不太合适，只是为了说明泛型方法的特性。
        T test = container.get();
        return test;
    }

    /**
     * static method should declare <T>
     * @param t
     * @param <T>
     */
    public static <T> void testStatic(T t){}
}

//error
//class ManGenerator implements Generator<T>{
//    @Override
//    public T get() {
//        return null;
//    }
//}